layui.form.verify({
    pwd: [/^[\S]{6,12}$/, '密码必须6到12位，且不能出现空格'],
    same: val => {
        if (val === $('[name="oldPwd"]').val()) return '新旧密码不能重复';
    },
    repwd: val => {
        if (val !== $('[name="newPwd"]').val()) return '确认密码不一致';
    }
});
$('.layui-form').submit(function (e) {
    e.preventDefault();
    let data = $(this).serialize();
    $.ajax({
        type: 'POST',
        url: '/my/updatepwd',
        data,
        success: res => {
            const {
                status,
                message
            } = res;
            if (status !== 0) return layui.layer.msg(message);
            $('.layui-form')[0].reset();
            window.parent.location.href = './login.html';
        }
    })
})